<?php
/******************************
@Filename	:study.php
@Version	:0.0.1
@Author		:xuhongquan
@Update		:2010-5-16
@Content	:php by Editplus
*******************************/
header("Content-type: text/html; charset=utf-8"); 
define('NOROBOT', TRUE);
require_once './include/common.inc.php';
include_once './include/dtxx.inc.php';
require_once("include/page.php");
$page=isset($_GET['page'])?intval($_GET['page']):0;
$id=isset($_GET['id'])?intval($_GET['id']):0;
$perpage=20;
$order=" order by tdate desc ";
$cname='study';
$table='bl_'.$cname;
if($id){
	$where=" where id='$id' and `isdel`='0' ";
}else{
	$where=" where `isdel`='0' ";
}
$sql_all="select count(*) as num from  $table $where ";
$n=$db->fetch_first($sql_all);
//print_r($n);die();
$list=new page($n['num'],$page,$perpage);  
$strartrow=$list->getStartRow();
$sql="select id,title,author,content,tdate from $table $where $order limit $strartrow,$perpage";   //从上面的起点开始查询出20条数据   
//echo "sql=".$sql;
$news=newlist($sql);
//print_r($news);die();
if(empty($news)){
	include template('error');
}else{	
	if($id){
		$dates=date('Y年m月d日',strtotime($news[0]['tdate']));
		include template($cname.'detail');
	}else{
		include template($cname);
	}
}




?>